<div class="span3">
    <div class="well sidebar-nav">
        <ul class="nav nav-list">
            <li class="nav-header"><?php echo __('Actions'); ?></li>
            <li><?php echo $this->Html->link(__('New Slider'), array('action' => 'add')); ?></li>
         </ul>
    </div>
</div>

<div class="span9">
    <?php echo $this->Session->flash(); ?>
    <div class="page-header">
        <h1><?php echo __('Sliders'); ?></h1>
    </div>

    <table class="table table-bordered table-striped">
        <thead>
    <tr>
            <th><?php echo $this->Paginator->sort('id'); ?></th>
            <th><?php echo $this->Paginator->sort('filename', 'Nombre'); ?></th>
            <th><?php echo $this->Paginator->sort('filepath', 'Imagen'); ?></th>
            <th><?php echo $this->Paginator->sort('link'); ?></th>
            <th><?php echo $this->Paginator->sort('alt'); ?></th>
            <th><?php echo $this->Paginator->sort('is_active', 'Activa'); ?></th>
            <th colspan="3"><?php echo __('Actions'); ?></th>
            </tr>
        </thead>
        <tbody>  
    <?php
    
    foreach ($sliders as $slider): ?>
        <?php 
        if (!empty($slider['Slider']['filepath'])) {
            $img = $this->Html->url(h($slider['Slider']['filepath']), true );
            $this->Fancybox->setProperties( array( 
                'class' => 'fancybox3',
                'className' => 'fancybox.image',
                'title'=> h($slider['Slider']['filename']),
                'rel' => 'gallery1'
                )
            );  
            $this->Fancybox->setPreviewContent('Ver imagen');
            $this->Fancybox->setMainContent($img); 
            $fancybox = $this->Fancybox->output();
        }
        ?>
    <tr>
        <td><?php echo h($slider['Slider']['id']); ?>&nbsp;</td>
        <td><?php echo h($slider['Slider']['filename']); ?>&nbsp;</td>
        <td><?php echo isset($fancybox) ? $fancybox : ''; ?>&nbsp;</td>
        <td><?php echo h($slider['Slider']['link']); ?>&nbsp;</td>
        <td><?php echo h($slider['Slider']['alt']); ?>&nbsp;</td>
        <td><?php echo (h($slider['Slider']['is_active'])) ? 'si' : 'no'; ?>&nbsp;</td>
        <td>
            <?php echo $this->Html->link(__('View'), array('action' => 'view', $slider['Slider']['id']), array('class' => 'btn btn-info')); ?>
        </td>
        <td>
            <?php echo $this->Html->link(__('Edit'), array('action' => 'edit', $slider['Slider']['id']), array('class' => 'btn btn-warning')); ?>
        </td>
        <td>
            <?php echo $this->Form->postLink(__('Delete'), array('action' => 'delete', $slider['Slider']['id']), array('class' => 'btn btn-danger'), __('Are you sure you want to delete # %s?', $slider['Slider']['id'])); ?>
        </td>
    </tr>
<?php endforeach; ?>
</tbody>
    </table>

<div class="well">
        <?php echo $this->Paginator->counter(array('format' => __d('cake', 'Page {:page} of {:pages}, showing {:current} records out of {:count} total, starting on record {:start}, ending on {:end}'))); ?>
    </div>
    <?php if ($this->Paginator->numbers()): ?>
        <div class="pagination">
            <ul>
                <?php echo $this->Paginator->first(); ?>
                <?php echo $this->Paginator->prev(); ?>
                <?php echo $this->Paginator->numbers(); ?>
                <?php echo $this->Paginator->next(); ?>
                <?php echo $this->Paginator->last(); ?>
            </ul>
        </div>
    <?php endif ?>
</div>



